package com.sky.mapper;

import com.sky.dto.EmployeeAccountStatusDTO;
import com.sky.entity.AddressBook;
import com.sky.entity.Employee;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface AddressBookMapper {

    @Insert("insert into address_book " +
            "(user_id,consignee,sex,phone,province_code,province_name,city_code,city_name,district_code,district_name,detail,label) " +
            "values (#{userId},#{consignee},#{sex},#{phone},#{provinceCode},#{provinceName},#{cityCode},#{cityName},#{districtCode},#{districtName},#{detail},#{label})")
    void save(AddressBook addressBook);

    @Select("select * from address_book where user_id = #{userId}")
    List<AddressBook> list(Long userId);

    @Select("select * from address_book where user_id = #{id} and is_default = 1")
    AddressBook defaultAddress(Long id);

    @Select("select * from address_book where id = #{addressBookId}")
    AddressBook getAddressBookById(Long addressBookId);
}
